package shiqi.PrototypePattern.shallowClone;
//任务：利用浅克隆实现邮件复制，复制邮件的同时不复制附件
public class Email implements Cloneable{

    private Attachement attachement = null;

    public Email() {
        this.attachement = new Attachement();
    }

    public Object clone() {
        Email clone = null;
        try {
            clone = (Email)super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return clone;
    }

    public Attachement getAttachement() {
        return this.attachement;
    }

    public void display() {
        System.out.println("查看邮件");
    }
}
